package com.tencreat.mapper.mall;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.tencreat.domain.mall.MallGoods;
import com.tencreat.domain.mall.MallStoreGoods;
import com.tencreat.domain.mall.dto.MallGoodsSearchDTO;
import com.tencreat.domain.mall.dto.MallStoreGoodsSearchDTO;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.math.BigDecimal;
import java.util.HashMap;
import java.util.List;

/**
 * 店铺商品基本信息Mapper接口
 *
 * @author tencreat
 * @date 2021-08-13
 */
@Repository
public interface MallStoreGoodsMapper extends BaseMapper<MallStoreGoods> {
    List<MallStoreGoods> selectOrderList(MallStoreGoods mallStoreGoods);

    /**
     * 锁商品
     * @param id 商品ID
     * @return 返回结果
     */
    MallStoreGoods selectForUpdateById(Long id);

    List<MallStoreGoods> getByOrderSn(@Param("orderSn") String orderSn);

    HashMap<String, BigDecimal> getGoodPrice(@Param("goodsId")Long goodsId, @Param("normsId")Long normsId);

    IPage<MallStoreGoods> getApiList(@Param("mallStoreGoodsSearchPo") MallStoreGoodsSearchDTO mallStoreGoodsSearchDTO, IPage<MallStoreGoods> page);

    void updateIsOnSaleByCategory(@Param("isOnSale") String isOnSale,@Param("categoryId") Long categoryId);
}
